package org.jeecg.modules.business.repertory.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.business.repertory.entity.WmsRepertory;
import org.jeecg.modules.business.repertory.entity.WmsRepertoryFreezeHistory;
import org.jeecg.modules.business.repertory.entity.vo.*;
import org.jeecg.modules.business.repertory.entity.vo.param.RepertoryParamVO;
import org.jeecg.modules.business.repertory.entity.vo.param.RepertoryTcParamVO;
import org.jeecg.modules.dock.entity.mes.request.RepertoryRequestParam;
import org.jeecg.modules.dock.entity.mes.response.MesBaseResponseVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description: 库存
 * @Author: jeecg-boot
 * @Date: 2023-07-31
 * @Version: V1.0
 */
public interface IWmsRepertoryService extends IService<WmsRepertory> {

    /**
     * 即时库存分页查询
     *
     * @param pageList
     * @param param
     * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<org.jeecg.modules.business.repertory.entity.vo.RepertoryVO>
     * @author hansen
     * @since 2023/8/10 12:56
     */
    IPage<org.jeecg.modules.business.repertory.entity.vo.RepertoryVO> listByPage(Page<RepertoryVO> pageList, RepertoryParamVO param);

    /**
     * 库存-锁定
     *
     * @param wmsRepertory
     * @return void
     * @author hansen
     * @since 2023/8/11 10:30
     */
    void lock(WmsRepertory wmsRepertory);

    /**
     * 通过id查询获取库区信息
     *
     * @param id
     * @return java.util.List<org.jeecg.modules.business.repertory.entity.vo.RepertoryAreaVO>
     * @author hansen
     * @since 2023/8/11 10:46
     */
    List<RepertoryAreaVO> getAreaById(String id);

    /**
     * 通过id查询获取库位信息
     *
     * @param id
     * @return java.util.List<org.jeecg.modules.business.repertory.entity.vo.RepertoryLocationVO>
     * @author hansen
     * @since 2023/8/11 11:10
     */
    List<RepertoryLocationVO> getLocationById(String id);

    /**
     * 库存-解锁
     *
     * @param wmsRepertory
     * @return void
     * @author hansen
     * @since 2023/8/11 13:49
     */
    void unlock(WmsRepertory wmsRepertory);

    /**
     * 库存-冻结
     *
     * @param wmsRepertoryFreezeHistory
     * @return void
     * @author hansen
     * @since 2023/8/11 13:51
     */
    void freeze(WmsRepertoryFreezeHistory wmsRepertoryFreezeHistory);

    /**
     * 库存-解冻
     *
     * @param wmsRepertoryFreezeHistory
     * @return void
     * @author hansen
     * @since 2023/8/11 13:54
     */
    void unfreeze(WmsRepertoryFreezeHistory wmsRepertoryFreezeHistory);

    /**
     * 通过id查询
     *
     * @param id
     * @return org.jeecg.modules.business.repertory.entity.vo.RepertoryVO
     * @author hansen
     * @since 2023/8/14 14:55
     */
    org.jeecg.modules.business.repertory.entity.vo.RepertoryVO queryById(String id);

    /**
     * 新增库存
     *
     * @param repertoryDocumentVOS
     * @return void
     * @author hansen
     * @since 2023/8/17 10:14
     */
    void add(RepertoryDocumentVO repertoryDocumentVOS);

    /**
     * 在途库存-增加在途库存
     *
     * @param repertoryDocumentVOS
     */
    void addInTransitRepertory(RepertoryDocumentVO repertoryDocumentVOS, String deliveryTaskId);

    /**
     * 在途库存-减少在途库存
     *
     * @param repertoryDocumentVOS
     * @param deliveryTaskId
     */
    void deleteInTransitRepertory(RepertoryDocumentVO repertoryDocumentVOS, String deliveryTaskId);

    /**
     * 库存-出库保存
     *
     * @param id
     * @return void
     * @author hansen
     * @since 2023/8/17 14:02
     */
    void reduce(RepertoryDocumentVO repertoryDocumentVOS);

    /**
     * 库存-出库保存
     *
     * @param id
     * @return void
     * @author hansen
     * @author hansen
     * @since 2023/8/31 9:13
     * @since 2023/8/31 9:13
     */

    void outSubmit(String id, boolean checkStock);

    /**
     * 库存-移库保存
     *
     * @return void
     * @author hansen
     * @since 2023/8/31 13:21
     */
    void moveSubmit(String id);

    /**
     * 库存-入库提交
     *
     * @param id
     * @return void
     * @author hansen
     * @since 2023/9/19 9:12
     */
    List<WmsRepertory> inSubmit(String id);

    /**
     * 库存-查询全部库存
     *
     * @return java.util.List<org.jeecg.modules.business.repertory.entity.vo.RepertoryVO>
     * @author hansen
     * @since 2023/10/10 9:34
     */
    List<RepertoryVO> all();

    /**
     * 导入
     *
     * @param request
     */
    Result<String> importExcel(HttpServletRequest request, String code);

    /**
     * 即时库存分页查询
     *
     * @param pageList
     * @param param
     * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<org.jeecg.modules.business.repertory.entity.vo.RepertoryVO>
     * @author hansen
     * @since 2023/8/10 12:56
     */
    List<RepertoryTcVO> listTcByPage(RepertoryTcParamVO param);

    MesBaseResponseVO getLocation(RepertoryRequestParam param);

    /**
     * 补充物料特性（原料）
     */
    void updateRawFeature(List<WmsRepertory> wmsRepertories);
}
